home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacFormat España 20
/
macformat_20.iso
/
mac
/
Shareware
/
Desarrolladores
/
Sprite Animation Toolkit 2.3.8
/
Add-ons
/
Lib ƒ
/
SATAddOnLib.h
< prev
next >
Wrap
Text File
|
1995-11-09
|
5KB
|
108 lines
/*SATAddOnLib is a lib of the "Add-ons" that are easily put in a library (i.e. the ones without*/
/*a "stubs" file). They include:*/
/*GammaFade*/
/*ProgressBar*/
/*FaceFromPict*/
/*SATToolbox*/
/*Preferences*/
/*Pixels*/
/**** GammaFade ****/
/*Screen fading routines.*/
pascal void FadeToBlack(long ticks);
pascal void FadeFromBlack(long ticks);
pascal FacePtr GetFaceFromPICT(short colorPICTid,short bwPICTid,short maskPICTid);
/* Pixel array types and routines */
typedef struct Pixel {
Point position;
char data1, data2, data3, data4;
} Pixel, Pixels, *PixelPtr;
pascal void SATDrawPixels (PixelPtr pix, SATPort *port, long value);
pascal void SATCopyPixels (PixelPtr pix, SATPort *src, SATPort *dest);
pascal void SATDrawPixelsSafe (PixelPtr pix, SATPort *port, long value);
pascal void SATCopyPixelsSafe (PixelPtr pix, SATPort *src, SATPort *dest);
/* Preference file handling */
pascal Boolean SetPrefFile(Str255 prefsFileName, OSType prefCreator,OSType prefType, short *appFile, short *prefFile, Boolean alwaysExternal);
pascal OSErr CopyResource(short fromFile, short toFile, ResType theResType, short id);
/* Progress bar */
typedef Ptr ProgressBarColorPtr;
typedef Ptr ProgressBarPtr;
pascal ProgressBarPtr InitProgressBar(short prefFile,short resID, Rect bounds, ProgressBarColorPtr colors);
pascal ProgressBarColorPtr ProgressBarColors(short frameRed,short frameGreen,short frameBlue,short backRed,short backGreen,short backBlue,short foreRed,short foreGreen,short foreBlue);
pascal ProgressBarColorPtr ProgressBarColorsRGB(RGBColor frame,RGBColor back,RGBColor fore);
pascal void AdvanceProgressBar(ProgressBarPtr thePB);
pascal void FinishProgressBar(ProgressBarPtr thePB);
/* Sprite record for sprites with fixed-point movement */
typedef struct {
/* Variables that you should change as appropriate */
short kind; /* Used for identification. >0: friend. <0 foe */
Point position;
Rect hotRect, hotRect2; /* Tells how large the sprite is; hotRect is centered around origo */
/*hotRect is set by you. hotRect2 is offset to the current position.*/
FacePtr face; /* Pointer to the Face (appearance) to be used. */
ProcPtr task; /* Callback-routine, called once per frame. If task=nil, the sprite is removed. */
ProcPtr hitTask; /* Callback in collisions. */
ProcPtr destructTask; /* Called when a sprite is disposed. (Usually nil.) */
RgnHandle clip; /*Clip region to be used when this sprite is drawn.*/
/* SAT variables that you shouldn't change: */
Point oldpos; /*Used by RunSAT2*/
SpritePtr next, prev; /*You may change them in your own sorting routine, but be careful if you do.*/
Rect r, oldr; /*Rectangle telling where to draw. Avoid messing with it.*/
FacePtr oldFace; /*Used by RunSAT2*/
Boolean dirty; /*Used by RunSAT2*/
/*Variables for internal use by the sprites. Use as you please. Edit as necessary - this is merely a default*/
/*set, enough space for most cases - but if you change the size of the record, call SetSpriteSize immediately*/
/*after initializing (before any sprites are created)!*/
short layer; /*For layer-sorting. When not used for that, use freely.*/
Point speed; /* Can be used for speed, but not necessarily. */
short mode; /* Usually used for different modes and/or to determine what image to show next. */
Point fixedPointPosition; /*fixed point position*/
long appLong; /*Longint for free use by the application.*/
} FixSprite, *FixSpritePtr;
/*Constants for separation/bounceoff between sprites*/
#define kPushBoth 0
#define kPushMe 1
#define kPushHim 2
/*Sprite utilities*/
pascal void MoveSprite(SpritePtr theSprite);
pascal Boolean KeepOnScreen(SpritePtr theSprite);
pascal void MoveSpriteFixedPoint(FixSpritePtr theSprite);
pascal Boolean KeepOnScreenFixed(FixSpritePtr theSprite);
pascal short RectSeparate(SpritePtr theSprite, SpritePtr anotherSprite, short push);
pascal void RectBounce(SpritePtr me, SpritePtr him, short push);
pascal void RectBounceFixed(FixSpritePtr me,FixSpritePtr him, short push);
pascal Boolean PtInSpriteRgn(Point p, SpritePtr theSprite);
pascal Boolean RegionHit(SpritePtr theSprite, SpritePtr anotherSprite);
pascal void SplitVector(Point v, Point d, Point * p, Point * n);
pascal void RegionBounce(FixSpritePtr s1, FixSpritePtr s2);
/**** Look-up table based fixed-point math operations. ****/
/*Good for high-speed math on 68k Macs. (Not tested too much yet.)*/
/*Don't change these constants without recompiling the lib!*/
#define kFixedPointShift 4 /*Number of fixed-point positions*/
#define kFixedOne 16 /*The "one" in the fixed-point system being used!*/
pascal void InitTables();
pascal long SquareRoot(long arg);
pascal long Sinus(long arg);
pascal long Cosinus(long arg);
pascal long VectorLength(Point vector);
pascal long FPVectorLength(Point vector);